using SS.core;
using System;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Drawing.Printing;
using System.Windows.Forms;
using TVSGPP.dir;
namespace SS
{
	public class frmupdtProductUsage : Form
	{
		private Func objFunc = new Func();
		public int ProductID = 0;
		private EAN13CodeCtl eaN13CodeCtl1;
		private int m_X = 11;
		private int m_Y = 55;
		private int m_Width = 225;
		private int m_Height = 103;
		private PrintDocument printDocument1;
		private int CurrIndex = -1;
		private int currGroup = 0;
		private products objP = new products();
		private bool loaded = false;
		private float m_Scale = 0.8f;
		public bool checkChange = false;
		public bool fastAdd = false;
		public string NameOfNewProduct = "";
		private IContainer components = null;
		private TextBox txtreTailPrice;
		private Label label9;
		private TextBox txtSalePrice;
		private TextBox txtInputPrice;
		private Button tSBClose;
		private DataGridView dgvRep;
		private ComboBox cbbList;
		private TextBox txtSearch;
		private Label label2;
		private Button btnShowAll;
		private TreeView tvGroup;
		private ImageList imageList1;
		private ToolTip toolTip1;
		private BindingNavigator bindingNavigator1;
		private ToolStripLabel bindingNavigatorCountItem;
		private ToolStripButton bindingNavigatorMoveFirstItem;
		private ToolStripButton bindingNavigatorMovePreviousItem;
		private ToolStripSeparator bindingNavigatorSeparator;
		private ToolStripTextBox bindingNavigatorPositionItem;
		private ToolStripSeparator bindingNavigatorSeparator1;
		private ToolStripButton bindingNavigatorMoveNextItem;
		private ToolStripButton bindingNavigatorMoveLastItem;
		private ToolStripSeparator bindingNavigatorSeparator2;
		private Button btnUpdate;
		private Button btnSave;
		private DataGridViewTextBoxColumn dg2;
		private DataGridViewTextBoxColumn PID;
		private DataGridViewTextBoxColumn Usage;
		private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
		private DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
		private DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
		public frmupdtProductUsage()
		{
			this.eaN13CodeCtl1 = new EAN13CodeCtl();
			this.eaN13CodeCtl1.BackColor = Color.White;
			this.eaN13CodeCtl1.Location = new Point(this.m_X, this.m_Y);
			this.eaN13CodeCtl1.Name = "eaN13CodeCtl1";
			this.eaN13CodeCtl1.Size = new Size(this.m_Width, this.m_Height);
			this.eaN13CodeCtl1.TabIndex = 50;
			this.InitializeComponent();
		}
		private void tSBClose_Click(object sender, EventArgs e)
		{
			base.Close();
		}
		private void FrmupdtProduct_Load(object sender, EventArgs e)
		{
			Program.strConnectionString = this.objFunc.strConnectionString;
			this.cbbList.SelectedIndex = 0;
			this.LoadtvGProducts();
			try
			{
				this.cbbList.SelectedIndex = 1;
			}
			catch
			{
			}
			if (!this.fastAdd)
			{
				this.loadToListViewFirstTime(this.dgvRep, this.bindingNavigator1);
			}
			this.loaded = true;
			this.tvGroup.SelectedNode = this.tvGroup.Nodes[0].Nodes[0];
		}
		public void loadToListViewFirstTime(DataGridView lv, BindingNavigator bdn)
		{
			try
			{
				lv.AutoGenerateColumns = false;
				SqlConnection sqlConnection = new SqlConnection(Program.strConnectionString);
				string cmdText;
				if (this.cbbList.SelectedIndex == 0)
				{
					cmdText = "SELECT TOP 100 PERCENT 0 AS TT,PID,P_Name,Usage FROM [TabProducts],[TabUnitProduct] WHERE [TabProducts].[P_DonViTinh] = [TabUnitProduct].[UnitID] ORDER BY [P_Name]";
				}
				else
				{
					cmdText = "SELECT TOP 100 PERCENT 0 AS TT,PID,P_Name,Usage FROM [TabProducts],[TabUnitProduct] WHERE SUBSTRING([TabProducts].[P_name], 1, 1) = '" + this.cbbList.Text.Replace("------ ", "") + "' AND [TabProducts].[P_DonViTinh] = [TabUnitProduct].[UnitID] ORDER BY [P_Name]";
				}
				SqlCommand selectCommand = new SqlCommand(cmdText, sqlConnection);
				SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(selectCommand);
				DataSet dataSet = new DataSet();
				sqlConnection.Open();
				sqlDataAdapter.Fill(dataSet);
				BindingSource bindingSource = new BindingSource();
				bindingSource.DataSource = dataSet.Tables["TabIngredient"];
				bdn.BindingSource = bindingSource;
				lv.DataSource = bindingSource;
				sqlConnection.Close();
				sqlConnection.Dispose();
				sqlDataAdapter.Dispose();
				dataSet.Dispose();
			}
			catch
			{
			}
		}
		public void searchProducts(DataGridView lv)
		{
			lv.AutoGenerateColumns = false;
			SqlConnection sqlConnection = new SqlConnection(Program.strConnectionString);
			string text;
			if (this.currGroup != 0)
			{
				text = " AND [GpID] = " + this.currGroup.ToString();
			}
			else
			{
				text = "";
			}
			string text2;
			if (this.txtSearch.Text != "")
			{
				text2 = string.Concat(new string[]
				{
					" AND (Upper(TabProducts.P_Name) LIKE N'%",
					this.txtSearch.Text.ToUpper(),
					"%' OR Upper(TabProducts.NameSearch) LIKE N'%",
					this.txtSearch.Text.ToUpper(),
					"%' ) "
				});
			}
			else
			{
				text2 = " ";
			}
			string cmdText;
			if (this.cbbList.SelectedIndex == 0)
			{
				cmdText = "SELECT TOP 100 PERCENT 0 AS TT,PID,P_Name,Usage FROM [TabProducts],[TabUnitProduct] WHERE [TabProducts].[P_DonViTinh] = [TabUnitProduct].[UnitID] " + text2 + text + " ORDER BY [P_Name]";
			}
			else
			{
				cmdText = string.Concat(new string[]
				{
					"SELECT TOP 100 PERCENT 0 AS TT,PID,P_Name,Usage FROM [TabProducts],[TabUnitProduct] WHERE SUBSTRING([TabProducts].[P_name], 1, 1) = '",
					this.cbbList.Text.Replace("------ ", ""),
					"' AND [TabProducts].[P_DonViTinh] = [TabUnitProduct].[UnitID] ",
					text2,
					text,
					"  ORDER BY [P_Name]"
				});
			}
			SqlCommand selectCommand = new SqlCommand(cmdText, sqlConnection);
			SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(selectCommand);
			DataSet dataSet = new DataSet();
			sqlConnection.Open();
			sqlDataAdapter.Fill(dataSet);
			BindingSource bindingSource = new BindingSource();
			bindingSource.DataSource = dataSet.Tables[0];
			this.bindingNavigator1.BindingSource = bindingSource;
			lv.DataSource = bindingSource;
			sqlConnection.Close();
			sqlConnection.Dispose();
			sqlDataAdapter.Dispose();
			dataSet.Dispose();
		}
		private void UpdateUsageProduct(int tmpID, string Usage)
		{
			SqlConnection sqlConnection = new SqlConnection(Program.strConnectionString);
			sqlConnection.Open();
			SqlCommand sqlCommand = new SqlCommand("UpdateUsageOfProduct", sqlConnection);
			sqlCommand.CommandType = CommandType.StoredProcedure;
			sqlCommand.Parameters.Add("PID", SqlDbType.Int);
			sqlCommand.Parameters.Add("Usage", SqlDbType.NVarChar, 2000);
			sqlCommand.Parameters["PID"].Value = tmpID;
			sqlCommand.Parameters["Usage"].Value = Usage;
			sqlCommand.ExecuteNonQuery();
			sqlConnection.Close();
			sqlConnection.Dispose();
		}
		private void txtInputPrice_KeyPress(object sender, KeyPressEventArgs e)
		{
			if (e.KeyChar == '\r')
			{
				this.txtSalePrice.Focus();
			}
		}
		private void txtSalePrice_KeyPress(object sender, KeyPressEventArgs e)
		{
			if (e.KeyChar == '\r')
			{
				this.txtreTailPrice.Focus();
			}
		}
		private void txtreTailPrice_KeyPress(object sender, KeyPressEventArgs e)
		{
			if (e.KeyChar == '\r')
			{
			}
		}
		private void txtMinimumNumber_KeyPress(object sender, KeyPressEventArgs e)
		{
			if (!char.IsDigit(e.KeyChar) && !char.IsControl(e.KeyChar))
			{
				e.Handled = true;
			}
		}
		private void txtUnit_KeyPress(object sender, KeyPressEventArgs e)
		{
			if (e.KeyChar == '\r')
			{
				this.txtInputPrice.Focus();
			}
		}
		private void txtRealSalePrice_KeyPress(object sender, KeyPressEventArgs e)
		{
			if (e.KeyChar == '\r')
			{
				this.txtreTailPrice.Focus();
			}
		}
		private void txtRealretailPrice_KeyPress(object sender, KeyPressEventArgs e)
		{
			if (e.KeyChar == '\r')
			{
			}
		}
		private void UpdateNameForSearch()
		{
			SqlConnection sqlConnection = new SqlConnection(Program.strConnectionString);
			SqlConnection sqlConnection2 = new SqlConnection(Program.strConnectionString);
			SqlCommand sqlCommand = sqlConnection.CreateCommand();
			SqlCommand sqlCommand2 = sqlConnection2.CreateCommand();
			sqlCommand.CommandText = "SELECT PID,P_Name FROM TabProducts ";
			sqlConnection.Open();
			sqlConnection2.Open();
			SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
			if (sqlDataReader.HasRows)
			{
				while (sqlDataReader.Read())
				{
					sqlCommand2.CommandText = "UPDATE [TabProducts] SET [NameSearch]='" + this.NameForSearch(sqlDataReader["P_Name"].ToString()) + "' WHERE [PID]=" + sqlDataReader["PID"].ToString();
					sqlCommand2.ExecuteNonQuery();
				}
			}
			sqlDataReader.Close();
			sqlDataReader.Dispose();
			sqlConnection2.Close();
			sqlConnection2.Dispose();
			sqlConnection.Close();
			sqlConnection.Dispose();
			MessageBox.Show("Bạn vừa thực hiện công việc lập mục tìm kiếm thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
		}
		private string NameForSearch(string RealName)
		{
			RealName = RealName.ToLower();
			RealName = RealName.Replace("ư", "u").Replace("ứ", "u").Replace("ự", "u").Replace("ử", "u").Replace("ừ", "u").Replace("ữ", "u");
			RealName = RealName.Replace("ú", "u").Replace("ụ", "u").Replace("ủ", "u").Replace("ù", "u").Replace("ũ", "u");
			RealName = RealName.Replace("á", "a").Replace("ạ", "a").Replace("ả", "a").Replace("à", "a").Replace("ã", "a");
			RealName = RealName.Replace("â", "a").Replace("ấ", "a").Replace("ẩ", "a").Replace("ầ", "a").Replace("ậ", "a").Replace("ẫ", "a");
			RealName = RealName.Replace("ă", "a").Replace("ắ", "a").Replace("ẳ", "a").Replace("ằ", "a").Replace("ặ", "a").Replace("ẵ", "a");
			RealName = RealName.Replace("ê", "e").Replace("ế", "e").Replace("ể", "e").Replace("ề", "e").Replace("ệ", "e").Replace("ễ", "e");
			RealName = RealName.Replace("é", "e").Replace("ẹ", "e").Replace("ẻ", "e").Replace("è", "e").Replace("ẽ", "e");
			RealName = RealName.Replace("í", "i").Replace("ị", "i").Replace("ỉ", "i").Replace("ì", "i").Replace("ĩ", "i");
			RealName = RealName.Replace("ý", "y").Replace("ỵ", "y").Replace("ỷ", "y").Replace("ỳ", "y").Replace("ỹ", "y");
			RealName = RealName.Replace("ó", "o").Replace("ỏ", "o").Replace("ò", "o").Replace("ọ", "o").Replace("õ", "o");
			RealName = RealName.Replace("đ", "d");
			RealName = RealName.Replace("ơ", "o").Replace("ớ", "o").Replace("ở", "o").Replace("ờ", "o").Replace("ợ", "o").Replace("ỡ", "o");
			RealName = RealName.Replace("ô", "o").Replace("ố", "o").Replace("ổ", "o").Replace("ồ", "o").Replace("ộ", "o").Replace("ỗ", "o");
			return RealName;
		}
		private void txtInputPrice_Enter(object sender, EventArgs e)
		{
			this.txtInputPrice.BackColor = Color.Aqua;
		}
		private void txtSalePrice_Enter(object sender, EventArgs e)
		{
			this.txtSalePrice.BackColor = Color.Aqua;
		}
		private void txtreTailPrice_Enter(object sender, EventArgs e)
		{
			this.txtreTailPrice.BackColor = Color.Aqua;
		}
		private void txtInputPrice_Leave(object sender, EventArgs e)
		{
			this.txtInputPrice.BackColor = Color.White;
		}
		private void txtSalePrice_Leave(object sender, EventArgs e)
		{
			this.txtSalePrice.BackColor = Color.White;
		}
		private void txtreTailPrice_Leave(object sender, EventArgs e)
		{
			this.txtreTailPrice.BackColor = Color.White;
		}
		private void cbbUnitProduct_KeyPress(object sender, KeyPressEventArgs e)
		{
			if (e.KeyChar == '\r')
			{
				this.txtInputPrice.Focus();
			}
		}
		private void txtSearchFor_KeyPress(object sender, KeyPressEventArgs e)
		{
		}
		private void FrmupdtProduct_KeyDown(object sender, KeyEventArgs e)
		{
			if (e.KeyCode == Keys.F5)
			{
				this.btnUpdate.PerformClick();
			}
			else
			{
				if (e.KeyCode == Keys.Escape)
				{
					base.Close();
				}
			}
		}
		private void btnUp_Click(object sender, EventArgs e)
		{
			if (this.eaN13CodeCtl1.Scale < 0.8f && this.dgvRep.SelectedRows.Count > 0)
			{
				this.eaN13CodeCtl1.X = (int)((double)((float)this.eaN13CodeCtl1.X * 1.25f) + 0.5);
				this.eaN13CodeCtl1.Y = (int)((double)((float)this.eaN13CodeCtl1.Y * 1.25f) + 0.5);
				this.eaN13CodeCtl1.Width = (int)((double)((float)this.eaN13CodeCtl1.Width * 1.25f) + 0.5);
				this.eaN13CodeCtl1.Height = (int)((double)((float)this.eaN13CodeCtl1.Height * 1.25f) + 0.5);
				this.eaN13CodeCtl1.Scale = this.eaN13CodeCtl1.Scale * 1.25f;
				this.m_Scale = this.eaN13CodeCtl1.Scale;
			}
		}
		private void btnDown_Click(object sender, EventArgs e)
		{
			if (this.eaN13CodeCtl1.Scale > 0.6f && this.dgvRep.SelectedRows.Count > 0)
			{
				this.eaN13CodeCtl1.X = (int)((double)((float)this.eaN13CodeCtl1.X * 0.8f) + 0.5);
				this.eaN13CodeCtl1.Y = (int)((double)((float)this.eaN13CodeCtl1.Y * 0.8f) + 0.5);
				this.eaN13CodeCtl1.Width = (int)((double)((float)this.eaN13CodeCtl1.Width * 0.8f) + 0.5);
				this.eaN13CodeCtl1.Height = (int)((double)((float)this.eaN13CodeCtl1.Height * 0.8f) + 0.5);
				this.eaN13CodeCtl1.Scale = this.eaN13CodeCtl1.Scale * 0.8f;
				this.m_Scale = this.eaN13CodeCtl1.Scale;
			}
		}
		private void btnFastGroupProduct_Click(object sender, EventArgs e)
		{
			new FrmupdtGproduct
			{
				Size = new Size(500, 300),
				StartPosition = FormStartPosition.Manual,
				FormBorderStyle = FormBorderStyle.FixedToolWindow//,
				//StartPosition = FormStartPosition.CenterScreen
			}.ShowDialog();
			this.LoadtvGProducts();
		}
		private void FrmupdtProduct_SizeChanged(object sender, EventArgs e)
		{
		}
		private void dgvRep_CellEnter(object sender, DataGridViewCellEventArgs e)
		{
			if (this.loaded)
			{
				try
				{
					this.CurrIndex = this.dgvRep.CurrentRow.Index;
					this.ProductID = int.Parse(this.dgvRep.Rows[this.dgvRep.CurrentRow.Index].Cells["dg6"].Value.ToString());
					this.eaN13CodeCtl1.m_Price = string.Format(Program.lenAffterDecimal, double.Parse(this.txtreTailPrice.Text));
					this.eaN13CodeCtl1.Scale = this.m_Scale;
				}
				catch
				{
				}
			}
		}
		private void btnListDesease_Click(object sender, EventArgs e)
		{
			if (this.ProductID > 0)
			{
				new frmProductDesease
				{
					Pid = this.ProductID
				}.ShowDialog();
			}
			else
			{
				MessageBox.Show("Bạn chưa chọn sản phẩm hoặc thêm mà chưa lưu thông tin về sản phẩm", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
			}
		}
		private void cbbList_SelectedIndexChanged(object sender, EventArgs e)
		{
			this.loadToListViewFirstTime(this.dgvRep, this.bindingNavigator1);
		}
		private void txtSearch_TextChanged(object sender, EventArgs e)
		{
			if (this.loaded)
			{
				this.searchProducts(this.dgvRep);
			}
		}
		private void btnShowAll_Click(object sender, EventArgs e)
		{
			this.txtSearch.Text = "";
			this.searchProducts(this.dgvRep);
		}
		private void LoadtvGProducts()
		{
			this.tvGroup.Nodes.Clear();
			string text = "";
			SqlConnection sqlConnection = new SqlConnection(this.objFunc.strConnectionString);
			sqlConnection.Open();
			if (text == "")
			{
				text = "SELECT * FROM [TabGproducts] ORDER BY [GpName]";
			}
			SqlCommand sqlCommand = new SqlCommand(text, sqlConnection);
			SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
			TreeNode treeNode = new TreeNode();
			treeNode = new TreeNode("Nhóm thuốc");
			treeNode.Name = "0";
			treeNode.ImageIndex = 0;
			treeNode.ExpandAll();
			if (sqlDataReader.HasRows)
			{
				while (sqlDataReader.Read())
				{
					TreeNode treeNode2 = new TreeNode();
					treeNode2.ImageIndex = 0;
					treeNode2.SelectedImageIndex = 1;
					treeNode2.ExpandAll();
					treeNode2.ForeColor = Color.Black;
					treeNode2.Text = sqlDataReader["GpName"].ToString();
					treeNode2.Name = sqlDataReader["GpID"].ToString();
					treeNode.Nodes.Add(treeNode2);
				}
			}
			sqlDataReader.Close();
			sqlDataReader.Dispose();
			this.tvGroup.Nodes.Add(treeNode);
			sqlConnection.Close();
			sqlConnection.Dispose();
		}
		private void tvGroup_AfterSelect(object sender, TreeViewEventArgs e)
		{
			try
			{
				this.currGroup = int.Parse(this.tvGroup.SelectedNode.Name);
				this.searchProducts(this.dgvRep);
			}
			catch
			{
			}
		}
		private void txtSearch_Enter(object sender, EventArgs e)
		{
			this.cbbList.SelectedIndex = 0;
		}
		private void btnUpdate_Click(object sender, EventArgs e)
		{
			this.btnSave.Enabled = true;
			this.dgvRep.ReadOnly = false;
			this.dgvRep.Focus();
		}
		private void btnSave_Click(object sender, EventArgs e)
		{
			try
			{
				for (int i = 0; i < this.dgvRep.RowCount; i++)
				{
					this.UpdateUsageProduct(int.Parse(this.dgvRep.Rows[i].Cells["PID"].Value.ToString()), this.dgvRep.Rows[i].Cells["Usage"].Value.ToString());
				}
				MessageBox.Show("Quá trình cập nhật dữ liệu đã hoàn thành!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
				this.btnSave.Enabled = false;
			}
			catch
			{
			}
			this.dgvRep.ReadOnly = true;
			this.dgvRep.Focus();
		}
		protected override void Dispose(bool disposing)
		{
			if (disposing && this.components != null)
			{
				this.components.Dispose();
			}
			base.Dispose(disposing);
		}
		private void InitializeComponent()
		{
			this.components = new Container();
			DataGridViewCellStyle dataGridViewCellStyle = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle2 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle3 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle4 = new DataGridViewCellStyle();
			ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(frmupdtProductUsage));
			DataGridViewCellStyle dataGridViewCellStyle5 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle6 = new DataGridViewCellStyle();
			this.printDocument1 = new PrintDocument();
			this.txtreTailPrice = new TextBox();
			this.label9 = new Label();
			this.txtSalePrice = new TextBox();
			this.txtInputPrice = new TextBox();
			this.tSBClose = new Button();
			this.dgvRep = new DataGridView();
			this.dg2 = new DataGridViewTextBoxColumn();
			this.PID = new DataGridViewTextBoxColumn();
			this.Usage = new DataGridViewTextBoxColumn();
			this.cbbList = new ComboBox();
			this.txtSearch = new TextBox();
			this.label2 = new Label();
			this.btnShowAll = new Button();
			this.tvGroup = new TreeView();
			this.imageList1 = new ImageList(this.components);
			this.toolTip1 = new ToolTip(this.components);
			this.bindingNavigator1 = new BindingNavigator(this.components);
			this.bindingNavigatorCountItem = new ToolStripLabel();
			this.bindingNavigatorMoveFirstItem = new ToolStripButton();
			this.bindingNavigatorMovePreviousItem = new ToolStripButton();
			this.bindingNavigatorSeparator = new ToolStripSeparator();
			this.bindingNavigatorPositionItem = new ToolStripTextBox();
			this.bindingNavigatorSeparator1 = new ToolStripSeparator();
			this.bindingNavigatorMoveNextItem = new ToolStripButton();
			this.bindingNavigatorMoveLastItem = new ToolStripButton();
			this.bindingNavigatorSeparator2 = new ToolStripSeparator();
			this.btnUpdate = new Button();
			this.btnSave = new Button();
			this.dataGridViewTextBoxColumn1 = new DataGridViewTextBoxColumn();
			this.dataGridViewTextBoxColumn2 = new DataGridViewTextBoxColumn();
			this.dataGridViewTextBoxColumn3 = new DataGridViewTextBoxColumn();
			((ISupportInitialize)this.dgvRep).BeginInit();
			((ISupportInitialize)this.bindingNavigator1).BeginInit();
			this.bindingNavigator1.SuspendLayout();
			base.SuspendLayout();
			this.txtreTailPrice.BackColor = Color.White;
			this.txtreTailPrice.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.txtreTailPrice.Location = new Point(511, 317);
			this.txtreTailPrice.Name = "txtreTailPrice";
			this.txtreTailPrice.Size = new Size(96, 22);
			this.txtreTailPrice.TabIndex = 7;
			this.txtreTailPrice.Text = "0";
			this.txtreTailPrice.TextAlign = HorizontalAlignment.Right;
			this.txtreTailPrice.Leave += new EventHandler(this.txtreTailPrice_Leave);
			this.txtreTailPrice.KeyPress += new KeyPressEventHandler(this.txtreTailPrice_KeyPress);
			this.txtreTailPrice.Enter += new EventHandler(this.txtreTailPrice_Enter);
			this.label9.AutoSize = true;
			this.label9.Location = new Point(439, 320);
			this.label9.Name = "label9";
			this.label9.Size = new Size(69, 15);
			this.label9.TabIndex = 14;
			this.label9.Text = "Giá bán lẻ :";
			this.txtSalePrice.BackColor = Color.White;
			this.txtSalePrice.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.txtSalePrice.Location = new Point(300, 317);
			this.txtSalePrice.Name = "txtSalePrice";
			this.txtSalePrice.Size = new Size(96, 22);
			this.txtSalePrice.TabIndex = 6;
			this.txtSalePrice.Text = "0";
			this.txtSalePrice.TextAlign = HorizontalAlignment.Right;
			this.txtSalePrice.Leave += new EventHandler(this.txtSalePrice_Leave);
			this.txtSalePrice.KeyPress += new KeyPressEventHandler(this.txtSalePrice_KeyPress);
			this.txtSalePrice.Enter += new EventHandler(this.txtSalePrice_Enter);
			this.txtInputPrice.BackColor = Color.White;
			this.txtInputPrice.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.txtInputPrice.Location = new Point(284, 317);
			this.txtInputPrice.Name = "txtInputPrice";
			this.txtInputPrice.Size = new Size(108, 22);
			this.txtInputPrice.TabIndex = 5;
			this.txtInputPrice.Text = "0";
			this.txtInputPrice.TextAlign = HorizontalAlignment.Right;
			this.txtInputPrice.Leave += new EventHandler(this.txtInputPrice_Leave);
			this.txtInputPrice.KeyPress += new KeyPressEventHandler(this.txtInputPrice_KeyPress);
			this.txtInputPrice.Enter += new EventHandler(this.txtInputPrice_Enter);
			this.tSBClose.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right);
			this.tSBClose.BackColor = SystemColors.ControlLight;
			this.tSBClose.Cursor = Cursors.Hand;
			this.tSBClose.FlatAppearance.BorderColor = Color.Gray;
			this.tSBClose.FlatStyle = FlatStyle.System;
			this.tSBClose.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.tSBClose.ImageAlign = ContentAlignment.MiddleLeft;
//			this.tSBClose.ImeMode = ImeMode.NoControl;
			this.tSBClose.Location = new Point(795, 565);
			this.tSBClose.Name = "tSBClose";
			this.tSBClose.Size = new Size(100, 30);
			this.tSBClose.TabIndex = 8;
			this.tSBClose.Text = "Thoát  [ ESC ]";
			this.tSBClose.UseVisualStyleBackColor = false;
			this.tSBClose.Click += new EventHandler(this.tSBClose_Click);
			this.dgvRep.AllowUserToAddRows = false;
			this.dgvRep.AllowUserToDeleteRows = false;
			this.dgvRep.AllowUserToResizeColumns = false;
			this.dgvRep.AllowUserToResizeRows = false;
			dataGridViewCellStyle.BackColor = Color.FromArgb(192, 255, 255);
			dataGridViewCellStyle.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.dgvRep.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle;
			this.dgvRep.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
			this.dgvRep.BackgroundColor = Color.White;
			this.dgvRep.BorderStyle = BorderStyle.Fixed3D;
			this.dgvRep.ColumnHeadersHeight = 26;
			this.dgvRep.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
			this.dgvRep.Columns.AddRange(new DataGridViewColumn[]
			{
				this.dg2,
				this.PID,
				this.Usage
			});
			this.dgvRep.Cursor = Cursors.Hand;
			this.dgvRep.EnableHeadersVisualStyles = false;
			this.dgvRep.Location = new Point(276, 46);
			this.dgvRep.Name = "dgvRep";
			this.dgvRep.ReadOnly = true;
			this.dgvRep.RowHeadersVisible = false;
			this.dgvRep.RowHeadersWidth = 26;
			this.dgvRep.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing;
			dataGridViewCellStyle2.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.dgvRep.RowsDefaultCellStyle = dataGridViewCellStyle2;
			this.dgvRep.RowTemplate.DefaultCellStyle.BackColor = Color.White;
			this.dgvRep.RowTemplate.DefaultCellStyle.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.dgvRep.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
			this.dgvRep.Size = new Size(618, 513);
			this.dgvRep.TabIndex = 4;
			this.dgvRep.CellEnter += new DataGridViewCellEventHandler(this.dgvRep_CellEnter);
			this.dg2.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.dg2.DataPropertyName = "P_Name";
			dataGridViewCellStyle3.Alignment = DataGridViewContentAlignment.MiddleLeft;
			dataGridViewCellStyle3.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			dataGridViewCellStyle3.NullValue = null;
			this.dg2.DefaultCellStyle = dataGridViewCellStyle3;
			this.dg2.DividerWidth = 1;
			this.dg2.HeaderText = "Tên thuốc";
			this.dg2.MinimumWidth = 200;
			this.dg2.Name = "dg2";
			this.dg2.ReadOnly = true;
			this.dg2.Width = 200;
			this.PID.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.PID.DataPropertyName = "PID";
			this.PID.HeaderText = "PID";
			this.PID.Name = "PID";
			this.PID.ReadOnly = true;
			this.PID.Resizable = DataGridViewTriState.False;
			this.PID.Visible = false;
			this.PID.Width = 5;
			this.Usage.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
			this.Usage.DataPropertyName = "Usage";
			dataGridViewCellStyle4.Alignment = DataGridViewContentAlignment.MiddleLeft;
			dataGridViewCellStyle4.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 0);
			dataGridViewCellStyle4.ForeColor = Color.Red;
			this.Usage.DefaultCellStyle = dataGridViewCellStyle4;
			this.Usage.HeaderText = "Liều dùng";
			this.Usage.MinimumWidth = 90;
			this.Usage.Name = "Usage";
			this.Usage.ReadOnly = true;
			this.cbbList.DropDownStyle = ComboBoxStyle.DropDownList;
			this.cbbList.Font = new Font("Arial", 12.75f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.cbbList.FormattingEnabled = true;
			this.cbbList.Items.AddRange(new object[]
			{
				"TẨT CẢ",
				"------ A",
				"------ B",
				"------ C",
				"------ D",
				"------ E",
				"------ F",
				"------ G",
				"------ H",
				"------ I",
				"------ J",
				"------ K",
				"------ L",
				"------ M",
				"------ N",
				"------ O",
				"------ P",
				"------ Q",
				"------ R",
				"------ S",
				"------ T",
				"------ U",
				"------ V",
				"------ W",
				"------ X",
				"------ Y",
				"------ Z"
			});
			this.cbbList.Location = new Point(5, 11);
			this.cbbList.Name = "cbbList";
			this.cbbList.Size = new Size(102, 27);
			this.cbbList.TabIndex = 0;
			this.cbbList.SelectedIndexChanged += new EventHandler(this.cbbList_SelectedIndexChanged);
			this.txtSearch.AcceptsReturn = true;
			this.txtSearch.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.txtSearch.Font = new Font("Arial", 11.25f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.txtSearch.Location = new Point(477, 13);
			this.txtSearch.Name = "txtSearch";
			this.txtSearch.Size = new Size(417, 25);
			this.txtSearch.TabIndex = 3;
			this.txtSearch.TextChanged += new EventHandler(this.txtSearch_TextChanged);
			this.txtSearch.Enter += new EventHandler(this.txtSearch_Enter);
			this.label2.BackColor = Color.FromArgb(255, 255, 192);
			this.label2.BorderStyle = BorderStyle.Fixed3D;
			this.label2.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.label2.Location = new Point(276, 13);
			this.label2.Name = "label2";
			this.label2.Size = new Size(199, 24);
			this.label2.TabIndex = 127;
			this.label2.Text = "Tìm theo tên sản phẩm :";
			this.label2.TextAlign = ContentAlignment.MiddleRight;
			this.btnShowAll.FlatAppearance.BorderColor = Color.FromArgb(128, 128, 255);
			this.btnShowAll.FlatStyle = FlatStyle.Flat;
			this.btnShowAll.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnShowAll.Location = new Point(113, 12);
			this.btnShowAll.Name = "btnShowAll";
			this.btnShowAll.Size = new Size(157, 26);
			this.btnShowAll.TabIndex = 1;
			this.btnShowAll.Text = "Xem tất cả";
			this.btnShowAll.UseVisualStyleBackColor = true;
			this.btnShowAll.Click += new EventHandler(this.btnShowAll_Click);
			this.tvGroup.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left);
			this.tvGroup.ImageIndex = 0;
//			this.tvGroup.ImageList = this.imageList1;
			this.tvGroup.Location = new Point(5, 46);
			this.tvGroup.Name = "tvGroup";
			this.tvGroup.SelectedImageIndex = 0;
			this.tvGroup.ShowNodeToolTips = true;
			this.tvGroup.ShowRootLines = false;
			this.tvGroup.Size = new Size(265, 549);
			this.tvGroup.TabIndex = 2;
			this.tvGroup.AfterSelect += new TreeViewEventHandler(this.tvGroup_AfterSelect);
//			this.imageList1.ImageStream = (ImageListStreamer)componentResourceManager.GetObject("imageList1.ImageStream");
			this.imageList1.TransparentColor = Color.Transparent;
			this.imageList1.Images.SetKeyName(0, "star_2.png");
			this.imageList1.Images.SetKeyName(1, "31.png");
			this.toolTip1.IsBalloon = true;
			this.bindingNavigator1.AddNewItem = null;
			this.bindingNavigator1.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
			this.bindingNavigator1.AutoSize = false;
			this.bindingNavigator1.BackColor = SystemColors.ButtonFace;
			this.bindingNavigator1.CountItem = this.bindingNavigatorCountItem;
			this.bindingNavigator1.CountItemFormat = "/ {0}";
			this.bindingNavigator1.DeleteItem = null;
			this.bindingNavigator1.Dock = DockStyle.None;
			this.bindingNavigator1.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.bindingNavigator1.GripStyle = ToolStripGripStyle.Hidden;
			this.bindingNavigator1.Items.AddRange(new ToolStripItem[]
			{
				this.bindingNavigatorMoveFirstItem,
				this.bindingNavigatorMovePreviousItem,
				this.bindingNavigatorSeparator,
				this.bindingNavigatorPositionItem,
				this.bindingNavigatorCountItem,
				this.bindingNavigatorSeparator1,
				this.bindingNavigatorMoveNextItem,
				this.bindingNavigatorMoveLastItem,
				this.bindingNavigatorSeparator2
			});
			this.bindingNavigator1.Location = new Point(276, 567);
			this.bindingNavigator1.MoveFirstItem = this.bindingNavigatorMoveFirstItem;
			this.bindingNavigator1.MoveLastItem = this.bindingNavigatorMoveLastItem;
			this.bindingNavigator1.MoveNextItem = this.bindingNavigatorMoveNextItem;
			this.bindingNavigator1.MovePreviousItem = this.bindingNavigatorMovePreviousItem;
			this.bindingNavigator1.Name = "bindingNavigator1";
			this.bindingNavigator1.PositionItem = this.bindingNavigatorPositionItem;
			this.bindingNavigator1.RenderMode = ToolStripRenderMode.Professional;
			this.bindingNavigator1.Size = new Size(618, 25);
			this.bindingNavigator1.TabIndex = 5;
			this.bindingNavigator1.Text = "bindingNavigator1";
			this.bindingNavigatorCountItem.Name = "bindingNavigatorCountItem";
			this.bindingNavigatorCountItem.Size = new Size(28, 22);
			this.bindingNavigatorCountItem.Text = "/ {0}";
			this.bindingNavigatorCountItem.ToolTipText = "Total number of items";
			this.bindingNavigatorMoveFirstItem.DisplayStyle = ToolStripItemDisplayStyle.Image;
			//this.bindingNavigatorMoveFirstItem.Image = (Image)componentResourceManager.GetObject("bindingNavigatorMoveFirstItem.Image");
			this.bindingNavigatorMoveFirstItem.Name = "bindingNavigatorMoveFirstItem";
			this.bindingNavigatorMoveFirstItem.RightToLeftAutoMirrorImage = true;
			this.bindingNavigatorMoveFirstItem.Size = new Size(23, 22);
			this.bindingNavigatorMoveFirstItem.Text = "Move first";
			this.bindingNavigatorMovePreviousItem.DisplayStyle = ToolStripItemDisplayStyle.Image;
			//this.bindingNavigatorMovePreviousItem.Image = (Image)componentResourceManager.GetObject("bindingNavigatorMovePreviousItem.Image");
			this.bindingNavigatorMovePreviousItem.Name = "bindingNavigatorMovePreviousItem";
			this.bindingNavigatorMovePreviousItem.RightToLeftAutoMirrorImage = true;
			this.bindingNavigatorMovePreviousItem.Size = new Size(23, 22);
			this.bindingNavigatorMovePreviousItem.Text = "Move previous";
			this.bindingNavigatorSeparator.Name = "bindingNavigatorSeparator";
			this.bindingNavigatorSeparator.Size = new Size(6, 25);
			this.bindingNavigatorPositionItem.AccessibleName = "Position";
			this.bindingNavigatorPositionItem.AutoSize = false;
			this.bindingNavigatorPositionItem.BackColor = SystemColors.ButtonFace;
			this.bindingNavigatorPositionItem.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.bindingNavigatorPositionItem.Name = "bindingNavigatorPositionItem";
			this.bindingNavigatorPositionItem.Size = new Size(50, 21);
			this.bindingNavigatorPositionItem.Text = "0";
			this.bindingNavigatorPositionItem.TextBoxTextAlign = HorizontalAlignment.Center;
			this.bindingNavigatorPositionItem.ToolTipText = "Current position";
			this.bindingNavigatorSeparator1.Name = "bindingNavigatorSeparator1";
			this.bindingNavigatorSeparator1.Size = new Size(6, 25);
			this.bindingNavigatorMoveNextItem.DisplayStyle = ToolStripItemDisplayStyle.Image;
			//this.bindingNavigatorMoveNextItem.Image = (Image)componentResourceManager.GetObject("bindingNavigatorMoveNextItem.Image");
			this.bindingNavigatorMoveNextItem.Name = "bindingNavigatorMoveNextItem";
			this.bindingNavigatorMoveNextItem.RightToLeftAutoMirrorImage = true;
			this.bindingNavigatorMoveNextItem.Size = new Size(23, 22);
			this.bindingNavigatorMoveNextItem.Text = "Move next";
			this.bindingNavigatorMoveLastItem.DisplayStyle = ToolStripItemDisplayStyle.Image;
			//this.bindingNavigatorMoveLastItem.Image = (Image)componentResourceManager.GetObject("bindingNavigatorMoveLastItem.Image");
			this.bindingNavigatorMoveLastItem.Name = "bindingNavigatorMoveLastItem";
			this.bindingNavigatorMoveLastItem.RightToLeftAutoMirrorImage = true;
			this.bindingNavigatorMoveLastItem.Size = new Size(23, 22);
			this.bindingNavigatorMoveLastItem.Text = "Move last";
			this.bindingNavigatorSeparator2.Name = "bindingNavigatorSeparator2";
			this.bindingNavigatorSeparator2.Size = new Size(6, 25);
			this.btnUpdate.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right);
			this.btnUpdate.BackColor = SystemColors.ControlLight;
			this.btnUpdate.Cursor = Cursors.Hand;
			this.btnUpdate.FlatAppearance.BorderColor = Color.Gray;
			this.btnUpdate.FlatStyle = FlatStyle.System;
			this.btnUpdate.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnUpdate.ImageAlign = ContentAlignment.MiddleLeft;
//			this.btnUpdate.ImeMode = ImeMode.NoControl;
			this.btnUpdate.Location = new Point(591, 565);
			this.btnUpdate.Name = "btnUpdate";
			this.btnUpdate.Size = new Size(100, 30);
			this.btnUpdate.TabIndex = 6;
			this.btnUpdate.Text = "Cập nhật [ F5 ]";
			this.btnUpdate.UseVisualStyleBackColor = false;
			this.btnUpdate.Click += new EventHandler(this.btnUpdate_Click);
			this.btnSave.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right);
			this.btnSave.BackColor = SystemColors.ControlLight;
			this.btnSave.Cursor = Cursors.Hand;
			this.btnSave.Enabled = false;
			this.btnSave.FlatAppearance.BorderColor = Color.Gray;
			this.btnSave.FlatStyle = FlatStyle.System;
			this.btnSave.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnSave.ImageAlign = ContentAlignment.MiddleLeft;
//			this.btnSave.ImeMode = ImeMode.NoControl;
			this.btnSave.Location = new Point(693, 565);
			this.btnSave.Name = "btnSave";
			this.btnSave.Size = new Size(100, 30);
			this.btnSave.TabIndex = 7;
			this.btnSave.Text = "Ghi nhận [ F6 ]";
			this.btnSave.UseVisualStyleBackColor = false;
			this.btnSave.Click += new EventHandler(this.btnSave_Click);
			this.dataGridViewTextBoxColumn1.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.dataGridViewTextBoxColumn1.DataPropertyName = "P_Name";
			dataGridViewCellStyle5.Alignment = DataGridViewContentAlignment.MiddleLeft;
			dataGridViewCellStyle5.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			dataGridViewCellStyle5.NullValue = null;
			this.dataGridViewTextBoxColumn1.DefaultCellStyle = dataGridViewCellStyle5;
			this.dataGridViewTextBoxColumn1.DividerWidth = 1;
			this.dataGridViewTextBoxColumn1.HeaderText = "Tên thuốc";
			this.dataGridViewTextBoxColumn1.MinimumWidth = 200;
			this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
			this.dataGridViewTextBoxColumn1.Width = 200;
			this.dataGridViewTextBoxColumn2.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.dataGridViewTextBoxColumn2.DataPropertyName = "PID";
			this.dataGridViewTextBoxColumn2.HeaderText = "PID";
			this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
			this.dataGridViewTextBoxColumn2.Resizable = DataGridViewTriState.False;
			this.dataGridViewTextBoxColumn2.Visible = false;
			this.dataGridViewTextBoxColumn2.Width = 5;
			this.dataGridViewTextBoxColumn3.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
			this.dataGridViewTextBoxColumn3.DataPropertyName = "Usage";
			dataGridViewCellStyle6.Alignment = DataGridViewContentAlignment.MiddleLeft;
			dataGridViewCellStyle6.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 0);
			dataGridViewCellStyle6.ForeColor = Color.Red;
			this.dataGridViewTextBoxColumn3.DefaultCellStyle = dataGridViewCellStyle6;
			this.dataGridViewTextBoxColumn3.HeaderText = "Liều dùng";
			this.dataGridViewTextBoxColumn3.MinimumWidth = 90;
			this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
			base.AutoScaleDimensions = new SizeF(7f, 15f);
			//base.AutoScaleMode = AutoScaleMode.Font;
			this.BackgroundImageLayout = ImageLayout.Stretch;
			base.ClientSize = new Size(900, 600);
			base.Controls.Add(this.btnSave);
			base.Controls.Add(this.btnUpdate);
			base.Controls.Add(this.tvGroup);
			base.Controls.Add(this.btnShowAll);
			base.Controls.Add(this.txtSearch);
			base.Controls.Add(this.label2);
			base.Controls.Add(this.cbbList);
			base.Controls.Add(this.dgvRep);
			base.Controls.Add(this.tSBClose);
			base.Controls.Add(this.label9);
			base.Controls.Add(this.txtInputPrice);
			base.Controls.Add(this.txtreTailPrice);
			base.Controls.Add(this.txtSalePrice);
			base.Controls.Add(this.bindingNavigator1);
			this.DoubleBuffered = true;
			this.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 0);
			//base.Icon = (System.Drawing.Icon)componentResourceManager.GetObject("$this.Icon");
			//base.Icon = (Icon)componentResourceManager.GetObject("$this.Icon");
			base.KeyPreview = true;
			base.MaximizeBox = false;
			base.MinimizeBox = false;
			this.MinimumSize = new Size(900, 600);
			base.Name = "frmupdtProductUsage";
			base.ShowInTaskbar = false;
			base.StartPosition = FormStartPosition.CenterScreen;
			this.Text = "THUỐC - LIỀU DÙNG";
			base.Load += new EventHandler(this.FrmupdtProduct_Load);
			base.SizeChanged += new EventHandler(this.FrmupdtProduct_SizeChanged);
			base.KeyDown += new KeyEventHandler(this.FrmupdtProduct_KeyDown);
			((ISupportInitialize)this.dgvRep).EndInit();
			((ISupportInitialize)this.bindingNavigator1).EndInit();
			this.bindingNavigator1.ResumeLayout(false);
			this.bindingNavigator1.PerformLayout();
			base.ResumeLayout(false);
			base.PerformLayout();
		}
	}
}
